
<div class="layui-fluid nepadmin-pad0 nepadmin-mar0 list0"  lay-title="用户协议">
<div class="layui-form" lay-filter="layuiadmin-form-role" id="form">
	<div class="form-cont" style="max-height:800px;">

		<div class="layui-form-item">
		  <label class="layui-form-label">用户协议</label>
		  <div class="layui-input-block">
		      <textarea id="edit" style="display: none;"></textarea>
		  </div>
		</div>
		
	</div>
  <div class="form-btns">
      <input type="button" value="保存" class="layui-btn">
  </div>
</div>
</div>
<style type="text/css">
	.layui-layedit{
		
	}
	
	.form-btns
	{
	    text-align: center;
	    padding: 10px 0 0px;
	    border-top: 1px solid #ddd;
	    /* position: absolute; */
	    width: 100%;
	    bottom: -10px;
	    background: #fff;
	}
</style>
<script>
	var forms=new Vue({
			el:'#form',
			data:{
				role:[],
					//type:1,
					detail:{
						status:1
					},
					old_detail:{}
			},
			mounted() {
					//初始化
				var _this=this;
				layui.admin.ajax('notify/agreement',{},1).then(function(res){
				//if(this.type!=1) this.detail=layui.admin.objData.detail,this.old_detail=JSON.stringify(layui.admin.objData.detail);
					_this.detail=res.data,_this.old_detail=JSON.stringify(res.data);
					
					console.log(_this.detail);
					
					layui.$('#edit').html(_this.detail.content);
					layui.use('layedit', function(){
					  var layedit=layui.layedit,$=layui.$;
					  /* layedit.set({
							  uploadImage: {
								  url: layui.conf.ajaxUrl+'login/upload_img'
								  ,type: 'post'
							  }
					  }); */
					  var index=layedit.build('edit',{
						  tool: ['strong' //加粗
						  ,'italic' //斜体
						  ,'underline' //下划线
						  ,'del' //删除线
						  
						  ,'|' //分割线
						  
						  ,'left' //左对齐
						  ,'center' //居中对齐
						  ,'right'],
						 height: 700
					  });
					  $('.form-btns input').click(function(){
						  var data=layedit.getContent(index);
						  _this.submit(data)
					  });
					});
				});
			},
			methods:{
				/* radioF(){//radio选择
					this.detail.status==1?this.detail.status=2:this.detail.status=1;
				}, */
				submit(data){
					if(layui.admin.form('#form')){
						if(!data){
							return layui.admin.ahint(2,'用户协议必填');
						}
						this.detail.content=data;

						layui.admin.formapi('notify/set_agreement',this.detail);
					}
				}
			}
		})
</script>
